package top.lyc829.mymusic.ui.fragment.search

import androidx.lifecycle.ViewModelProvider
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.viewModels
import top.lyc829.mymusic.R
import top.lyc829.mymusic.base.BaseFragment
import top.lyc829.mymusic.base.BaseViewModel
import top.lyc829.mymusic.databinding.FragmentSearchBinding

class SearchFragment : BaseFragment<SearchViewModel, FragmentSearchBinding>() {

    companion object {
        fun newInstance() = SearchFragment()
        const val TAG = "SearchFragment"
    }

    override fun initView(savedInstanceState: Bundle?) {

    }

    override fun initClickListener() {

    }

    override fun createObserver() {
        mViewModel.searchList.observe(viewLifecycleOwner) {
            Log.d(TAG, it.toString())
        }
    }

    override fun initData() {
        mViewModel.getSearchList()
    }


    override fun getViewModel(): SearchViewModel {
        return ViewModelProvider(this).get(SearchViewModel::class.java)
    }

    override fun getBinding(inflater: LayoutInflater) = FragmentSearchBinding.inflate(inflater)


}